﻿using System;
using System.Web.UI;

namespace Components.Data.UI.MasterPages
{
  public class MasterPageBinding
  {
    public MasterPageBinding(String path, String masterPageFile)
    {
      Path = path;
      MasterPageFile = masterPageFile;
    }

    public String Path { get; set; }

    public String MasterPageFile { get; set; }

    public Boolean BindMasterPage(Control control)
    {
      if (control is Page)
      {
        ((Page)control).MasterPageFile = this.MasterPageFile;
        return true;
      }
      if (control is MasterPage)
      {
        ((MasterPage)control).MasterPageFile = this.MasterPageFile;
        return true;
      }
      return false;
    }
  }
}
